package com.bobo.netty.utils.threadUtils;

import java.util.concurrent.RejectedExecutionHandler;

/**
 * 线程池工具类
 */
public final class ThreadPoolUtils {
    public ThreadPoolUtils() {
    }

    public static ThreadPoolManager singleThreadPoolManager(String threadNamePrefix) {
        return new ThreadPoolManager(threadNamePrefix, 1).init(false);
    }

    public static ThreadPoolManager commonThreadPoolManager(String threadNamePrefix, int poolSize) {
        return new ThreadPoolManager(threadNamePrefix, poolSize).init();
    }

    public static ThreadPoolManager commonThreadPoolManager(String threadNamePrefix, int poolSize, int maxPoolSize) {
        return new ThreadPoolManager(threadNamePrefix, poolSize, maxPoolSize).init();
    }

    public static ThreadPoolManager dynamicThreadPoolManager(String threadNamePrefix, int poolSize, IThreadConfigChange iThreadConfigChange) {
        return new ThreadPoolManager(threadNamePrefix, poolSize, iThreadConfigChange).init();
    }

    public static ThreadPoolManager dynamicFullThreadPoolManager(String threadNamePrefix, int poolSize, IThreadConfigChange iThreadConfigChange, int queueCapacity, RejectedExecutionHandler rejectedExecutionHandler) {
        return new ThreadPoolManager(threadNamePrefix, poolSize, iThreadConfigChange, queueCapacity, rejectedExecutionHandler).init();
    }
}
